package com.t168.appinfo.interceptor;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.t168.appinfo.entity.BackendUser;

public class BgInterceptor extends HandlerInterceptorAdapter {
	  public boolean preHandle(HttpServletRequest request, HttpServletResponse response,  
	            Object handler) throws Exception {
		HttpSession session =request.getSession();
		BackendUser backendUser = (BackendUser)session.getAttribute("bgUser");
		if(backendUser == null){
			response.sendRedirect(request.getContextPath()+"/403.jsp");
			return false;
		}
		return true;
	}

}
